#include <stdio.h>
#include <map>
#include <vector>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <algorithm>
#include <direct.h>

using namespace std;

string os_LoadFile(const char* folder, const char* filename) 
{

	/* loads a file from outside the vm for use by the server */

	char currentWorkingDir[255];
	_getcwd(currentWorkingDir, 255);

	string filePath = currentWorkingDir;
	filePath += "/";
	//filePath += folder;
	//filePath += "/";
	filePath += filename;

	FILE*	inputFile = fopen(filePath.c_str(),"rb");
	if(inputFile != NULL)
	{
		fseek(inputFile,0,SEEK_END);
		const int fSize = ftell(inputFile);
		fseek(inputFile,0,SEEK_SET);

		char* fileContents = new char[fSize+1];
		fread(fileContents, fSize,1,inputFile);
		fileContents[fSize] = '\0';
		fclose(inputFile); inputFile=0;

	    string deRefString = fileContents;
		delete [] fileContents;
		return deRefString;

	}
			
	return string("");

}